﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>3.高级视图语法—分支</title>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shCore.js"></script>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shBrushCSharp.js"></script>
    <script type="text/javascript" src="../../Content/highlighter/scripts/shBrushXml.js"></script>
    <link type="text/css" rel="stylesheet" href="../../Content/highlighter/styles/shCoreDefault.css" />
    <script type="text/javascript">SyntaxHighlighter.all();</script>
</head>
<body>
	<h3>高级视图语法—分支</h3>
    <pre class="brush: csharp;">
        @{int a = 3;}
        //if判断
        @if(a > 3)
        {
		    true
        }        
        else
        {
		    false
        }

        @if(a&gt;1)
        {
		    1
        }
        else if(a &gt; 2)
        {
            2
        }
        else
        {
            3
        }

        //switch判断
        @switch(a)
        {
            case 1:
                1;break;
            case 2:
                2;break;
            default:break;
        }

        @{int[] b=new int[]{1,2,3,4}; }
	</pre>
</body>
</html>
